package cn.baage.campus.utils;

import java.util.Random;

/**
 * @Description: 验证码工具
 * @Author: 八阿哥
 * @url: baage.cn
 * @Version: 1.0
 **/
public class CodeUtils {


    /**
     * 生成验证码
     *
     * @param size 验证码位数
     * @return 验证码
     */
    public static String randomCode(Integer size) {
        StringBuilder str = new StringBuilder();
        Random random = new Random();
        for (int i = 0; i < size; i++) {
            str.append(random.nextInt(10));
        }
        return str.toString();
    }

}
